/**
 * 用户管理js
 */

creatPageList(1);
function creatPageList(currentPage){
    var userName = $("#search_userName").val();
    var trueName = $("#search_trueName").val();
    var roleId = $("#search_roleId").val();
    $.ajax({
        type: "POST",
        url: Query,
        data: {"pageNo": currentPage, "userName":userName, "trueName":trueName, 'roleId':roleId},
        cache: false,
        async: true,
        beforeSend: function () {
            $('#context-table-container').html("<div align='center'><img style='margin-left: auto;margin-right: auto;' src='"+loadingImgPath+"' /></div>");
        },
        success: function (data) {
            $('#context-table-container').html(data);
        }
    });
}

function deleteUser(id) {
    layer.confirm("您确定要删除该用户信息吗？", {icon:3,move:false}, function () {
        var url = projectPath+"/sys/user/delete.do";
        $.post(url, {'id':id}, function (data) {
            if(data.msg){
                layer.msg("删除成功", {icon:1,time:1000,shade: 0.01});
                creatPageList(1);
            }else{
                layer.msg("删除失败", {icon:2,time:1000,shade: 0.01});
            }
        }, 'json')
    });
}
